
function isRequestSuccess(json) {
    return json.errorCode == 0 && json.success;
}

function splitBySpace(cls) {
    return cls.split(/\s+/);
}


function getFilePrefixOnly(str) {
    var filePrefix = str.substring(0, str.lastIndexOf("."));
    return filePrefix;
}

function nullToEmptyString(arr) {
    if (isNullObj(arr)) {
        return "";
    }
    return arr;
}

function isEmpty(str) {
    return str == null || str == undefined || str == '';
}
function isNullObj(obj) {
    return obj == null || obj == undefined;
}
function nullToEmptyArray(arr) {
    if (isNullObj(arr)) {
        return [];
    }
    if (arr instanceof Array) {
        return arr;
    }
    if (typeof arr == "object") {
        return [arr];
    }
    return [];

}
function nullToEmptyObject(o) {
    if(isNullObj(o)) {
        return {};
    }
    return o;
}
